import openpyxl

wb = openpyxl.load_workbook(r"F:\my_profile\study\code_pub\study_code_pub\python表格\index.xlsx")
sheet1 = wb.active

# 读取指定区域的表格数据
for _i in sheet1.iter_rows(min_row=1,max_row=3,min_col=2):
    for cell in _i:
        print(cell.value)

# 直接读取
print(tuple(sheet1.rows))

# 读取指定区域2
ws = sheet1["A1:C5"]
for row in ws:
    for cell in row:
        print(cell.value)

# 大小
print(sheet1.max_row,sheet1.max_column)

# 字母编号索引
from openpyxl.utils import get_column_letter,column_index_from_string
print(get_column_letter(2))
print(get_column_letter(45))
print(column_index_from_string("AS"))